#ifndef EXPFILE_H
#define EXPFILE_H

#include <QFile>
#include <QStringList>
#include <QTextStream>
#include <QFileInfo>
#include <QListWidget>
#include <QDir>
#include <qmap.h>
#include "exp_define.h"
#include "qexppart.h"
#include "qerrormanager.h"
#include "expfile_global.h"
#include "qtrace.h"
#include "qerrorline.h"

class EXPFILE_EXPORT ExpFile : public QFile
{
  Q_OBJECT

public:
	ExpFile(QString filename);
	~ExpFile();

	void replace(QList<quint32> lines, QStringList field,QStringList values);
	QString lineAt(quint32 index);
	QEXPPart* partAt(quint32 index);
	QList<QEXPPart*> parts() const;
	quint32 partsCount() const { return m_parts.size(); }
	QString generatedPath() const;
	QList<QErrorLine*> checkError(QStringList plp,QStringList exportplp,QStringList pages);

signals:
	void reportLines(const QStringList&);
	void report(const QString&);

private:
	void rewrite();
	QString m_design;
	QStringList m_header;
	QMap<quint32,QEXPPart*> m_parts;
	QString m_filename;
	QHash<QString,QErrorLine*> m_checked;
};

#endif // QEXPFILE_H
